package com.daiTest.config;

import com.daiTest.interceptors.LoginProtectedlnterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/*这个配置类用于配置拦截器范围
* 加入拦截器和声明拦截范围*/
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Autowired
    private LoginProtectedlnterceptor loginProtectedlnterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginProtectedlnterceptor).addPathPatterns("/headline/**");
    }
}
